package pwd.allen.model;

import lombok.Data;

import java.io.Serializable;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.TreeMap;

/**
 * sheet4导出模型
 * @create 2019-10-13 15:56
 **/
@Data
public class Sheet4 implements Serializable {
    /**
     * 统计起始时间 yyyy年MM月
     */
    private String dateBegin;
    /**
     * 统计结束时间 yyyy年MM月
     */
    private String dateEnd;
    /**
     * 总计
     */
    private long total;
    /**
     * 分局集合
     */
    private Map<String, Station> station = new HashMap<>();
    /**
     * 每月信息集合
     */
    private Map<String, YmData> data = new TreeMap();

    public Sheet4(List<String> list_ym) {
        this.dateBegin = list_ym.get(0);
        this.dateEnd = list_ym.get(list_ym.size() - 1);
        for (String ym : list_ym) {
            Sheet4.YmData ymData = new Sheet4.YmData();
            ymData.setDatestr(ym);
            data.put(ym, ymData);
        }
    }

    @Data
    public static class YmData implements Serializable {
        private String datestr;
        private long total;
        private Map<String, Station> station = new HashMap<>();
    }

    @Data
    public static class Station implements Serializable {
        private String name;
        private long num;
        private long total = 0;
    }
}
